package ar.fiuba.tp7552.buildadmin.model.auth;

import org.springframework.security.core.GrantedAuthority;

import ar.fiuba.tp7552.buildadmin.model.BaseEntity;

public class Role extends BaseEntity implements GrantedAuthority {

	public static final String ROLE_ADMIN = "ROLE_ADMIN";
	public static final String ROLE_USER = "ROLE_USER";
	public static final String RESP_GASTOS = "RESP_GASTOS";
	public static final String RESP_COBROS = "RESP_COBROS";
	
	private String name;
	private String description;
	
	public Role() {
		super();
	}
	
	public Role(String name) {
		this.name = name;
	}
	
	@Override
	public String getAuthority() {
		return this.name;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	@Override
	public boolean equals(Object obj) {
		if ( !(obj instanceof Role) )
			return false;
		Role other = (Role) obj;
		if (this.id == null || other.id == null)
			return false;
		return this.id.equals(other.id);
	}

	@Override
	public int hashCode() {
		if (this.id != null )
			return id.hashCode();
		return super.hashCode();
	}

	@Override
	public String toString() {
		return name;
	}
	
	
	
	
	
}
